<script type="text/javascript">
		// Activo el Mejorador de SELECT
		jQuery(".chzn-select").chosen(); 
		jQuery(".chzn-select-deselect").chosen({allow_single_deselect:true});
		jQuery(".chzn-select").chosen({no_results_text: "No hay resultados"});

    function desactivarBtn(){
      jQuery("div.submit").hide();
    }

</script>
<img src="/estadisticas/save/12" width="1" height="1">
<div id="titulo_encabezado" style="margin-left: -10px">
	<div style="padding: 17px"><?php echo __('Agregar un Paciente Nuevo', true) ?></div>
	<div id="efecto-box">&nbsp;</div>
</div>

<div id="contenido_gral">
<?php echo $this->Form->create('Person', array('onSubmit' => 'desactivarBtn();'));?>
<?php
		echo $this->Form->input('stateperson_id',array( 'type' => 'hidden', 'value' => '1'));
		echo $this->Form->input('id_turno_paciente_tmp',array( 'type' => 'hidden', 'value' => $id_turno_paciente_tmp));
?>
  <table cellpadding="0" cellspacing="10">
    <tr> 
      <td width="33%"><?php echo $this->Form->input('name',array( 'label' => '1er. Nombre')); ?></td>
      <td width="33%"><?php echo $this->Form->input('name2',array( 'label' => '2do. Nombre')); ?></td>
      <td width="34%"><?php echo $this->Form->input('name3',array( 'label' => 'Otros Nombres')); ?></td>
    </tr>
    <tr> 
      <td><?php echo $this->Form->input('lastname',array( 'label' => '1er. Apellido'));?></td>
      <td><?php echo $this->Form->input('lastname2',array( 'label' => 'Otros Apellidos'));?></td>
      <td><?php echo $this->Form->input('lastname3',array( 'label' => 'Apellido Materno')); ?></td>
    </tr>
    <tr> 
      <td><?php echo $this->Form->input('gender_id',array( 'label' => 'Género','empty' => '--- Seleccione uno ---'));?></td>
      <td><?php echo $this->Form->input('sex_id',array( 'label' => 'Sexo', 'empty' => '--- Seleccione uno ---')); ?></td>
      <td><?php echo $this->Form->input('fecha_nacimiento',array( 'label' => 'Fecha de Nacimiento', 'empty' => '---'
                                    , 'dateFormat' => 'DMY'
                                    , 'minYear' => date('Y') - 100
                                    , 'maxYear' => date('Y') ));?></td>
    </tr>
    <tr> 
      <td><?php echo $this->Form->input('typodocument_id',array( 'label' => 'Tipo de Documento','empty' => '--- Seleccione uno ---'));?></td>
      <td><?php echo $this->Form->input('nro_documento',array( 'label' => 'Nro. de Documento')); ?></td>
      <td><?php echo $this->Form->input('gruposanguineo_id',array( 'label' => 'Grupo Sanguíneo','empty' => '--- Seleccione uno ---')); ?></td>
    </tr>
    <tr> 
      <td><?php echo $this->Form->input('email'); ?></td>
      <td><?php echo $this->Form->input('telefono',array( 'label' => 'Teléfono')); ?></td>
      <td>&nbsp;</td>
    </tr>
    <tr> 
      <td><?php echo $this->Form->input('direccion',array( 'label' => 'Domicilio')); ?></td>
      <td><?php echo $this->Form->input('localidad',array( 'label' => 'Localidad')); ?></td>
      <td><?php echo $this->Form->input('provincia',array( 'label' => 'Provincia / Region')); ?></td>
    </tr>

	<?php foreach($os as $clave=>$valor){ ?>
		<tr> 
		  <td><?php 
				echo $this->Form->input('OS.'.$clave.'.id', array(
										'class' 			=> 'chzn-select', 
										'options' 			=> $insurances, 
										'selected' 			=> $valor['id'], 
										'label' 			=> 'Financiador '.($clave+1), 
										'empty'				=> __('Ninguna',true), 
										'style' 			=> 'width:200px;font-size:12px;'
										)
									);		
				?>
		  </td>
		  <td><?php echo $this->Form->input('OS.'.$clave.'.plan'    ,array('value' => $valor['plan']    , 'label' => 'Plan'        ) ); ?>  </td>
		  <td><?php echo $this->Form->input('OS.'.$clave.'.afiliado',array('value' => $valor['afiliado'], 'label' => 'Nro.Afiliado') ); ?>  </td>
		</tr>
	<?php } ?>

    <tr> 
      <td colspan='3'><h2 style='font-size:16px;'>Profesional Derivante</h2></td>
    </tr>
    <tr> 
      <td><?php echo $this->Form->input('profesional_derivante',array( 'label' => 'Nombre del Profesional')); ?></td>
      <td><?php echo $this->Form->input('especialidad',array( 'label' => 'Especialidad')); ?></td>
      <td><?php echo $this->Form->input('telefono_contacto',array( 'label' => 'Teléfono de Contacto')); ?></td>
    </tr>
	
	
	
    <tr> 
      <td colspan="3"><?php echo $this->Form->end(__('Cargar', true)); ?></td>
    </tr>
  </table>
</div>